//
//  BySuperLottoFooterVIew.m
//  caipiao_ios
//
//  Created by mc on 2018/7/18.
//  Copyright © 2018年 ZhangZhanbin. All rights reserved.
//

#import "BySuperLottoFooterVIew.h"

@implementation BySuperLottoFooterVIew

- (id)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        self.backgroundColor = BY_BACKGROUND_COLOR;
        UIView *backgroundView = [[UIView alloc] initWithFrame:CGRectMake(18, 0, SCREEN_WIDTH - 36, frame.size.height)];
        [self addSubview:backgroundView];
        backgroundView.backgroundColor = [UIColor whiteColor];
        backgroundView.layer.cornerRadius = 3;
       
        UIView *deleteView = [[UIView alloc] init];
        [backgroundView addSubview:deleteView];
        [deleteView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerX.equalTo(backgroundView).offset(0);
            make.centerY.equalTo(backgroundView).offset(0);
            make.size.mas_equalTo(CGSizeMake(80, 20));
        }];
        
        UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapAction:)];
        [deleteView addGestureRecognizer:tap];
        
        
        UIImageView *deleteBtn = [[UIImageView alloc] init];
        [deleteView addSubview:deleteBtn];
        [deleteBtn mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(deleteView).offset(0);
            make.centerY.equalTo(deleteView).offset(0);
            make.size.mas_equalTo(CGSizeMake(15, 15));
        }];
        deleteBtn.image = [UIImage imageNamed:@"qingchu"];
        
        
        UILabel *titleLabel = [[UILabel alloc] init];
        [deleteView addSubview:titleLabel];
        [titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(deleteBtn.mas_right).offset(2);
            make.centerY.equalTo(deleteView).offset(0);
            make.height.mas_equalTo(@15);
            make.right.equalTo(deleteView).offset(0);
        }];
        titleLabel.text = @"清除所有";
        titleLabel.font = FONT(12);
        titleLabel.textColor = [UIColor lightGrayColor];
        titleLabel.textAlignment = NSTextAlignmentLeft;
        
        
        UIImageView *bottomView = [[UIImageView alloc] init];
        [backgroundView addSubview:bottomView];
        [bottomView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.bottom.equalTo(backgroundView).offset(0);
            make.left.equalTo(backgroundView).offset(0);
            make.right.equalTo(backgroundView).offset(0);
            make.height.mas_equalTo(@((SCREEN_WIDTH - 36) / 684.0 * 15));
        }];
        bottomView.image = [UIImage imageNamed:@"touzhudanbeijing下面"];
        
    }
    return self;
}


- (void)tapAction:(UITapGestureRecognizer *)tap{
    
    if (self.deleteBlock) {
        self.deleteBlock();
    }
    
}

@end
